/******************************************************************************
	This file is a part of the Snapshot Bioinformatics Project

	Copyright (C) 2012-2013 Jarom Schow

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef ELINK_H
#define ELINK_H

#include "Entrez.h"

#include <QtCore/QDate>

namespace Bio {

class BIO_EXPORT ELink : public Entrez {
public:
	enum Command { NoCommand = 0, Neighbor, NeighborScore, NeighborHistory, ACheck, NCheck, LCheck, LLinks, LLinksLib, PRLinks };

	ELink();
	ELink( const QString &db, const QString &dbfrom, Command cmd, const QString &id );
	ELink( const QString &db, const QString &dbfrom, Command cmd, const QStringList &ids );
	ELink( const QString &db, const QString &dbfrom, Command cmd, int queryKey, const QString &webEnv );
	virtual ~ELink();

	virtual bool	exec();

	void	setDatabase( const QString &db );
	QString	getDatabase() const;

	void	setDatabaseFrom( const QString &db );
	QString	getDatabaseFrom() const;

	void		addID( const QString &id );
	void		setIDs( const QStringList &ids );
	QStringList	getIDs() const;

	void	setHistory( int queryKey, const QString &webEnv );
	int		getQueryKey() const;
	QString	getWebEnv() const;

	void	setLinkname( const QString &linkname );
	QString	getLinkname() const;

	void	setTerm( const QString &term );
	QString	getTerm() const;

	void	setHolding( const QString &holding );
	QString	setHolding() const;

	void		setDateType( DateType type );
	DateType	getDateType() const;

	void	setRelDate( int num );
	int		getRelDate() const;

	void	setDateRange( const QDate &minDate, const QDate &maxDate );
	QDate	getMinDate() const;
	QDate	getMaxDate() const;

private:
	int			m_queryKey, m_relDate;
	QString		m_db, m_dbfrom, m_webEnv, m_linkname, m_term, m_holding;
	Command		m_cmd;
	QStringList	m_ids;
	DateType	m_dateType;
	QDate		m_minDate, m_maxDate;
};

}; // Bio

#endif // ELINK_H